class Solution {
public:
    int boolea = true;
    int Balance(TreeNode* root)
    {
        if (root == nullptr)
            return 0;
        int l = Balance(root->left);
        int r = Balance(root->right);
        if (abs(l - r) > 1)
            boolea = false;
        return max(r, l) + 1;
    }
    bool IsBalanced_Solution(TreeNode* pRoot) {
        if (pRoot == nullptr)
            return true;
        int len = abs(Balance(pRoot->left) - Balance(pRoot->right));
        if (len > 1)
            boolea = false;
        return boolea;
    }
};